package com.usian.login.controller;


import com.usian.common.pojo.ResultVo;
import com.usian.login.pojo.TbUser;
import com.usian.login.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/user")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @RequestMapping("send")
    public ResultVo send(String phone)throws Exception{
return loginService.sendCode(phone);
    }

    @RequestMapping("login")
    public ResultVo login(String phone,String code)throws Exception{
        return loginService.userLogin(phone,code);
    }

@RequestMapping("save")

public ResultVo save(@RequestBody TbUser tbUser){
        return loginService.save(tbUser);
}


}
